/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucue.recomendacionsakila.neg;

import edu.ucue.recomendacionsakila.dao.GenericController;
import edu.ucue.recomendacionsakila.mdl.Customer;
import edu.ucue.recomendacionsakila.mdl.Film;
import edu.ucue.recomendacionsakila.mdl.Rental;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Johnny
 */
public class FilmManager {
    GenericController<Film> controladorFilm = new GenericController<Film>();
    GenericController<Rental> controladorRental = new GenericController<Rental>();
    public List<Film> getFilms()
    {
        List<Film> listaPeliculas= controladorFilm.findEntities(new Film());
        return listaPeliculas;
    }
    public List<Film> getFilms(Customer cost)
    {
        List<Rental> listaRentas= controladorRental.findWhere(new Rental(), "customer_id="+cost.getCustomerId());
        List<Film> listaPeliculas = new ArrayList<Film>();
        for(int i=0;i<listaRentas.size();i++)
        {
            listaPeliculas.add(listaRentas.get(i).getInventoryId().getFilmId());
        }
        return listaPeliculas;
    }
    
    
    
}
